﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UIPanel_Quit : UIPanelBase {
    Transform panelRoot;
    Transform btnQuit;
    Transform btnCanel;

    public override void OnInit(Transform root)
    {
        base.OnInit(root);
        panelRoot = root;
        InitGameObj();
        InitEvent();
    }

    void InitGameObj()
    {
        btnQuit = panelRoot.Find("btn_quit");
        btnCanel = panelRoot.Find("btn_continue_play");
    }
    void InitEvent()
    {
        Button btn_quit = btnQuit.GetComponent<Button>();
        btn_quit.onClick.RemoveAllListeners();
        btn_quit.onClick.AddListener(()=> {
            Application.Quit();
        });
        Button btn_cancel = btnCanel.GetComponent<Button>();
        btn_cancel.onClick.RemoveAllListeners();
        btn_cancel.onClick.AddListener(()=>{
            UIManager.CloseUI<UIPanel_Quit>();
        });
    }

    public override void Update()
    {
        base.Update();
    }
    public override void OnClose()
    {
        base.OnClose();
    }
}
